package com.efesco.payroll.groupItem;

import com.bstek.dorado.view.AbstractViewModel;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.*;
import com.bstek.dorado.data.db.DBStatement;


/**
 * groupOrderViewModel
 */
public class groupOrderViewModel extends AbstractViewModel {

public void setOrder(ParameterSet parameters)
throws Exception {
Dataset groupDataset = getDataset("groupDataset");
DBStatement statement = new DBStatement();

try {
  groupDataset.moveFirst();
  RecordIterator ri = groupDataset.recordIterator();
  while (ri.hasNext()){
    Record record = ri.nextRecord();
    String groupId=record.getString("WA_GROUP_ID");
    String displayOrder=record.getString("DISPLAY_ORDER");
    statement.setSql(
    " update s_wa_group set DISPLAY_ORDER = "  + displayOrder +
    " where WA_GROUP_ID = "+groupId);
    statement.execute();
  }

}
finally {
  statement.close();
}
    }

}
